package com.forum.impl.confession;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;


import com.common.entity.ApiResult;
import com.common.utils.LocalContext;
import com.forum.mapper.confession.ConfessionWallCommentMapper;
import com.forum.param.ConfessionCommentQueryParam;
import com.forum.param.ConfessionSendCommentParam;
import com.forum.pojo.confession.ConfessionWallComment;
import com.forum.service.confession.ConfessionWallCommentService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author Tsing
 */
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class ConfessionWallCommentServiceImpl extends ServiceImpl<ConfessionWallCommentMapper, ConfessionWallComment> implements ConfessionWallCommentService {

    private final ConfessionWallCommentMapper commentMapper;

    @Override
    public ApiResult<String> sendComment(ConfessionSendCommentParam param) {
        Integer currentUserId = LocalContext.getCurrentUserId();
        ConfessionWallComment comment = new ConfessionWallComment(param.getConfessionId(),currentUserId,param.getContent());
        commentMapper.insert(comment);
        return ApiResult.success("发布成功");
    }

    @Override
    public Map<String, Object> getCommentsByConfession(ConfessionCommentQueryParam param) {

        return null;
    }
}
